#!/bin/bash
#==============编译Go项目=======确保在 pro-downloader 项目下
rm -rf ./cli/*
go-bindata -o=./assets/static.go -pkg=assets  static/... public/...
# ====在alpine镜像下 需要加入 CGO_ENABLED=0 不然运行报错
CGO_ENABLED=0 go build -o ./cli/app

# =============构建脚本================
docker stop pro-downloader
docker rm pro-downloader
docker rmi xiedongji/pro-downloader:v1.0

docker build -t="xiedongji/pro-downloader:v1.0" .
docker run -p 80:80 -p 3000:3000 --name "pro-downloader" -d -t -i xiedongji/pro-downloader:v1.0
docker exec -it pro-downloader /bin/sh


# ==============打标============
# docker login
# docker tag IMAGEID(镜像id) REPOSITORY:TAG（仓库：标签）
# docker xiedongji/kafka

# yum install -y net-tools
# docker logs kafka-test

# docker tag 411 registry.cn-shenzhen.aliyuncs.com/simon-micro-server/orange:v2.0

# docker stop orange-test && \
# docker rm orange-test && \
# docker build -t="xiedongji/orange:v1.0" .
